草庐IT

python - 无法初始化 Elixir

全部标签

ruby - 安装后无法使用 compass

我似乎无法使用thisVagrantfile使compass在Vagrant上工作.请在此处查看其余的bash脚本(已删除repo)(如果您想配置您的VagrantUbuntuBox,请参阅Vaprobash!)。因此,当我不得不使用gruntserver时,我正在学习gruntjs类(class)。唯一的问题是它需要更新的ruby​​版本(我相信是1.9+而不是1.8)并且它需要compass。所以我通过安装RVM和安装最新的稳定版本解决了ruby​​部分。compass应该很容易获得geminstallcompass并且它似乎确实已安装。但是当我输入compass-v时,我得到了休

ruby - 使用不同的参数和默认值在 Ruby 中初始化类的最有效方法是什么?

我想要一个类和一些属性,您可以在初始化期间设置这些属性或使用其默认值。classFruitattr_accessor:color,:typedefinitialize(color,type)@color=color||='green'@type=type||='pear'endendapple=Fruit.new(red,apple) 最佳答案 解决此问题的典型方法是使用具有默认值的散列。如果散列值是方法的最后一个参数,Ruby有一个很好的传递散列值的语法。classFruitattr_accessor:color,:typedef

ruby - 如何使用 new 干净地初始化 Ruby 中的属性?

classFooattr_accessor:name,:age,:email,:gender,:heightdefinitalizeparams@name=params[:name]@age=params[:age]@email=params[:email]...end这似乎是一种愚蠢的做法。在Ruby中初始化对象的更好/更惯用的方法是什么?ruby1.9.3 最佳答案 您可以只遍历键并调用setter。我更喜欢这个,因为如果你传递了一个无效的key,它会捕捉到。classFooattr_accessor:name,:age,:em

ruby-on-rails - 升级到 Yosemite 10.10 后无法连接到 postgresql 数据库

更新到Yosemite10.10后,我无法连接到我的postgresql数据库。我运行Rails控制台并尝试获取第一个用户,但出现此错误...>➜game_golfgit:(master)✗railsc>Loadingdevelopmentenvironment(Rails4.1.4)>[1]pry(main)>User.first>PG::ConnectionBad:couldnotconnecttoserver:Connectionrefused>Istheserverrunningonhost"localhost"(::1)andaccepting>TCP/IPconnectio

ruby - 无法在 Eclipse 4.2 上安装 Aptana 插件

我已经安装了Eclipse4.2Juno。现在我想安装aptana来开发ruby,但是我得到以下错误,Unabletoreadrepositoryathttp://download.aptana.com/studio3/plugin/install/content.jar.无法读取位于http://download.aptana.com/studio3/plugin/install/content.jar的存储库.读取超时 最佳答案 我认为到目前为止您可能已经解决了问题,但我遇到了完全相同的问题并在多次搜索后找到了解决方案,所以为了

ruby-on-rails - 运行 heroku create --stack cedar 时无法加载此类文件 -- readline (LoadError)

我正在尝试将我的Rails应用程序部署到Heroku以按照以下说明进行测试:http://devcenter.heroku.com/articles/rails3#prerequisites这是我要运行的命令:herokucreate--stackcedar我收到此错误消息:/home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in`require':cannotloadsuchfile--readline(LoadError)from/home/s

ruby-on-rails - 路由错误 - 未初始化的常量

我无法在Rails3.2.12中解决这个问题,也许我遗漏了什么。config/routes.rbget"home/index"root:to=>"home#index"devise_for:users,:only=>:omniauth_callbacksmatch'users/auth/:provider/callback'=>'authentications#create'match'/auth/:provider/signout'=>'authentications#signout'app/controllers/authentication_controller.rbclassA

ruby - 无法在生产服务器上更新 gem

无法在生产服务器上更新gem。我已经尝试过bundleinstall--deployment和bundleinstall--withoutdevelopmenttest但不断得到:YouaretryingtoinstallindeploymentmodeafterchangingyourGemfile.Run`bundleinstall`elsewhereandaddtheupdatedGemfile.locktoversioncontrol.Ifthisisadevelopmentmachine,removetheGemfilefreezebyrunning`bundleinstal

ruby - Ruby Gem 中未初始化的常量 Rake::DSL

我一直致力于更新我的gem(位于https://github.com/ivanoats/whm_xml_api_ruby的whm_xml)以使其与ruby​​1.9.2、最新的ruby​​gems、最新的bundler、最新的rdoc、最新的rake一起工作。它在1.8.7中运行良好,但仅在1.9.2中出现“未初始化常量Rake::DSL”错误。我认为rake0.9.2解决了这个问题,但也许没有?我在StackOverflow上阅读了很多内容,但仍然卡住了。关于去哪里看有什么想法吗?ivan:~/Development/ruby/whm_xml_api_ruby[git:master+

ruby-on-rails - 没有 sudo,Bundler 无法安装任何 gem

我正在尝试安装一个Rails应用程序,但每次我使用bundle时,如果没有sudo,它就会失败。我目前的情况是,只要对所有使用sudo,包括rails,一切都会正常。我认为这是不正确的。例如:$bundleupdateUpdatinggit://github.com/refinery/refinerycms.gitFetchinggemmetadatafromhttps://rubygems.org/.......Fetchinggemmetadatafromhttps://rubygems.org/..Resolvingdependencies...Enteryourpassword